<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

	<xsl:template match="HeaderInfo">
	
// GENNIT Castle ActiveRecord http://www.gennit.com
//
// Project: <xsl:value-of select="ProjectName"/>
//
// **************************************************************
// IMPORTANT BIT:
//
// This source code is is owned by you. No copyright is held by
// GENNIT. However, please note the disclaimer below
// **************************************************************
//
// GENNIT refers to the GENNIT website and anyone affiliated
// with the GENNIT system. Including but not limited to
// the administrator and service provider.
//
// Unless agreed to in writing, source code is distributed on an 
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
// either express or implied. GENNIT are not responsible for 
// your use/misuse of this code.

// When you use GENNIT code, you do so at your own risk and 
// GENNIT is not responsible for the accuracy, 
// reliability or functionality of the code. GENNIT expressly 
// disclaims any potential liability associated with use of 
// this generated code.

	
	 
using System;
using System.Collections;
using Castle.ActiveRecord;
using Castle.ActiveRecord.Framework;
using NHibernate.Expression;

	 
namespace <xsl:value-of select="ProjectName"/>.Dal 
{
<![CDATA[
	/// <summary>
	/// A dataobject must have an ObjectID and a Modified property..
	/// </summary>
	public interface IDataObject
	{
		/// <summary>
		/// A unique identifier for the ActiveRecord object.
		/// </summary>
		Guid ObjectID { get; set; }

		/// <summary>
		/// ActiveRecord object last modified date.
		/// </summary>
		DateTime Modified { get; set; }
	}




	/// <summary>
	/// The DataObject class is a base for all of the ActiveRecord objects.
	/// It contains an ObjectID and Modified properties which are
	/// found in all DataObject implementations.
	/// </summary>
	[Serializable]
	public abstract class DataObject : ActiveRecordBase, IDataObject
	{
		private DateTime modified;
		
		private Guid objectID;
		
		
		
		/// <summary>
		/// A globally unique identifier for the ActiveRecord object. Each 
		/// implementation will have their owner [Class]ID which returns
		/// this base property.
		/// </summary>
		public Guid ObjectID {
			get
			{
				return objectID;
			}
			
			set
			{
				objectID = value;
			}
		}



		/// <summary>
		/// This flag is used to prevent last-win situations, i.e if another
		/// process changes the object before a commit is made on the in
		/// memory object a StateObjectException will be thrown. It is
		/// recommended to use the Version() flag if this scenario is of
		/// particular concern due to precision issues with timestamps.
		/// 
		/// The Modified flag can also be used to return the last modified
		/// date of an object.
		/// </summary>
		[ Timestamp() ]
		public DateTime Modified
		{
			get
			{
				return modified;
			}
			
			set
			{
				modified = value;
			}
		}
		
		
		
		
		
		#region ActiveRecordBase Functionality
		
		
		// Provide Access to ActiveRecordBase functionality to 
		// implementing classes. This provides the ability for 
		// implementing classes to offer simpler functionality
		// which does not require the use of Type
		
		// See 
		// http://www.castleproject.org/activerecord/documentation/trunk/manual/aroperationsdocs/Generated_ActiveRecordBase.html
		// for more information regarding these methods functionality
		// This URL may change without warning as it is hosted offsite
	
		/// <summary>
		/// Returns a count of the amount of rows for the type
		/// </summary>
		/// <param name="type">ActiveRecord type</param>
		/// <returns>amount of rows from database</returns>
		internal static int ARCountAll ( Type type )
		{
			return CountAll ( type );
		}
		
		
		
		/// <summary>
		/// Returns a count of the amount of rows for the type
		/// </summary>
		/// <param name="type">ActiveRecord type</param>
		/// <param name="filter">HQL string</param>
		/// <param name="args">HQL Parameters</param>
		/// <returns>amount of rows from database</returns>
		internal static int ARCountAll ( Type type, 
				string filter, params object[] args )
		{
			return CountAll ( type, filter , args );
		}
		
		
		/// <summary>
		/// Delete all records of the ActiveRecord type
		/// </summary>
		/// <param name="type">ActiveRecord type</param>
		internal static void ARDeleteAll ( Type type )
		{
			DeleteAll ( type );
		}
		
		/// <summary>
		/// Delete all recrods for the ActiveRecord type
		/// </summary>
		/// <param name="type">ActiveRecord type</param>
		/// <param name="where">HQL where clause</param>
		internal static void ARDeleteAll ( Type type , string where )
		{
			DeleteAll ( type , where );
		}
		
		
		
		/// <summary>
		/// Returns all database objects of the ActiveRecord type
		/// </summary>
		/// <param name="type">ActiveRecord type</param>
		/// <returns>array of objects</returns>
		internal static Array ARFindAll ( Type type )
		{
			return FindAll ( type );
		}
		
		
		
		/// <summary>
		/// Returns database objects of the ActiveRecord type
		/// which match the criteria
		/// </summary>
		/// <param name="type">ActiveRecord type</param>
		/// <param name="criterias">criteria array</param>
		/// <returns>array of objects</returns>
		internal static Array ARFindAll ( Type type , 
					params ICriterion[] criterias )
		{
			return FindAll ( type , criterias );
		}
		
		
		
		/// <summary>
		/// Returns database objects of the ActiveRecord type
		/// using the primary key. ObjectID in the case of
		/// these objects.
		/// </summary>
		/// <param name="type">ActiveRecord type</param>
		/// <param name="id">PrimaryKey object Id</param>
		/// <returns>matching object</returns>
		internal static object ARFindByPrimaryKey ( Type type , object id )
		{
		
			return FindByPrimaryKey ( type , id );
		}
		
		
		/// <summary>
		/// Returns database objects of the ActiveRecord type
		/// using the primary key. ObjectID in the case of
		/// these objects.
		/// </summary>
		/// <param name="type">ActiveRecord type</param>
		/// <param name="id">PrimaryKey object Id</param>
		/// <param name="throwOnNotFound">true if you want to throw 
		/// exception on not finding the object, false to catch it</param>
		/// <returns>matching ActiveRecord object or null</returns>
		internal static object ARFindByPrimaryKey ( Type type , object id , 
						bool throwOnNotFound )
		{
			return FindByPrimaryKey ( type , id , throwOnNotFound );
		}
		
		
		/// <summary>
		/// Returns first object of the ActiveRecord type
		/// which matches the criteria
		/// </summary>
		/// <param name="type">ActiveRecord type</param>
		/// <param name="criterias">criteria array</param>
		/// <returns>first matching ActiveRecord object</returns>
		internal static object ARFindFirst ( Type type , 
					params ICriterion[] criterias )
		{
			return FindFirst ( type , criterias );
		}
		
		
		
		/// <summary>
		/// Return object based on a IActiveRecordQuery implementations
		/// such as ScalarQuery / SimpleQuery.
		/// </summary>
		/// <seealso cref="http://wiki.castleproject.org/index.php/ActiveRecord:Using_HQL"/>
		/// <param name="query">Query to execute</param>
		/// <returns>object results of type specified within query</returns>
		internal static object ARExecuteQuery ( IActiveRecordQuery query )
		{
			return ExecuteQuery ( query );
		}
		
		
		#endregion
		
	}
]]>
}

	
	
	
	</xsl:template>
</xsl:stylesheet>